package com.lyf.scm.plan.domain.remote.basedata;

import com.github.pagehelper.PageInfo;
import com.lyf.scm.plan.domain.remote.basedata.dto.*;
import com.rome.arch.core.clientobject.Response;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Set;

/**
 * 调用数据字典接口
 *
 * @author wuzhuang
 * @date 2020/06/30
 */
@FeignClient(name = "basedata-core")
public interface BaseDataRemote {

    /**
     * 根据编码查询字典明细
     *
     * @param pageNum  页面num
     * @param pageSize 页面大小
     * @param typeCode 类型代码
     * @return {@link Response<Object>}
     */
    @GetMapping("/v1/dictionary/searchByTypeCode")
    Response<PageInfo<BaseDataDTO>> queryByCode(@RequestParam("pageNum") Integer pageNum,
                                                @RequestParam("pageSize") Integer pageSize,
                                                @RequestParam("typeCode") String typeCode);


    /**
     * 调基础中心获取渠道信息
     *
     * @param channelCode
     * @return
     */
    @GetMapping("/v1/channel/{channelCode}")
    Response<ChannelInfoDTO> getChannelInfoByCode(@PathVariable("channelCode") String channelCode);

    /**
     * 根据地区name模糊查询地区信息
     *
     * @param name
     * @return
     */
    @GetMapping("/v1/area/searchAreaByName")
    Response<List<AreaDTO>> listAreaInfoByName(@RequestParam("name") String name);

    /**
     * 查询所有的门店
     *
     * @param storeSimpleParamDTO 存储简单的参数dto
     * @param pageNum             页面num
     * @param pageSize            页面大小
     * @return {@link Response<StoreDTO>}
     */
    @PostMapping("/v1/store/kp/page")
    Response<PageInfo<StoreDTO>> listStore(@RequestBody StoreDTO storeSimpleParamDTO, @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                           @RequestParam(value = "pageSize", defaultValue = "99") Integer pageSize);


    /**
     * 查询所有的门店
     *
     * @param storeSimpleParamDTO 存储简单的参数dto
     * @param pageNum             页面num
     * @param pageSize            页面大小
     * @return {@link Response<StoreDTO>}
     */
    @PostMapping("/v1/store/kp/page")
    Response<PageInfo<com.lyf.scm.plan.api.dto.StoreInfoDTO>> listStoreInfo(@RequestBody StoreDTO storeSimpleParamDTO, @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                                            @RequestParam(value = "pageSize", defaultValue = "99") Integer pageSize);
    /**
     * 根据code获取区域信息
     *
     * @param codes 区域code
     * @return
     */
    @PostMapping("v1/area/searchAreaByCodes")
    Response<List<AreaDTO>> listAreaInfoByCode(@RequestBody List<String> codes);

    /**
     * 批量根据parentCode获取所有下级
     *
     * @param parentCodes 父代码
     * @return {@link Response<List<AreaDTO>}
     */
    @PostMapping("/v1/area/batchSearchByParentCode")
    Response<List<AreaDTO>> batchSearchByParentCode(@RequestBody List<String> parentCodes);

    /**
     * 查询省下的门店
     *
     * @param provinceCodeList 省代码列表
     * @param pageNum          页面num
     * @param pageSize         页面大小
     * @return {@link Response<PageInfo<StoreDTO>>}
     */
    @PostMapping("/v1/store/selectStoreByProvinceCode")
    Response<PageInfo<StoreDTO>> listStoreByProvince(@RequestBody List<String> provinceCodeList,
                                                     @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                     @RequestParam(value = "pageSize", defaultValue = "100") Integer pageSize);

    /**
     * 查询市下面的门店
     *
     * @param cityCodeList 城市代码列表
     * @param pageNum      页面num
     * @param pageSize     页面大小
     * @return {@link Response<PageInfo<StoreDTO>>}
     */
    @PostMapping("/v1/store/selectStoreByCityCode")
    Response<PageInfo<StoreDTO>> listStoreByCity(@RequestBody List<String> cityCodeList,
                                                 @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                 @RequestParam(value = "pageSize", defaultValue = "100") Integer pageSize);

    /**
     * 查询区下面的门店
     *
     * @param districtCodeList 地区代码列表
     * @param pageNum          页面num
     * @param pageSize         页面大小
     * @return {@link Response<PageInfo<StoreDTO>>}
     */
    @PostMapping("/v1/store/selectStoreByDistrictCode")
    Response<PageInfo<StoreDTO>> listStoreByCounty(@RequestBody List<String> districtCodeList,
                                                   @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                   @RequestParam(value = "pageSize", defaultValue = "100") Integer pageSize);

    /**
     * 根据鲲鹏渠道映射出中台渠道
     *
     * @param channels 渠道
     * @return {@link Response<List<KpChannelSystemChannelDTO>>}
     */
    @PostMapping("/api/v1/kpChannelSystemChannel/queryByKpChannels")
    Response<List<KpChannelSystemChannelDTO>> queryByKpChannels(@RequestBody List<String> channels);


    /**
     * 批量根据父渠道查询子渠道信息
     *
     * @param parentChannels 家长频道
     * @return {@link Response<List<ChannelInfoDTO>>}
     */
    @PostMapping("/api/v1/kpChannel/external/queryByParentChannels")
    Response<List<ChannelInfoDTO>> queryByParentChannels(@RequestBody List<String> parentChannels);

    /**
     * 根据门店/公司/加盟商code和类型type(1公司2门店3加盟商)查询渠道集合(对外)
     *
     * @param channelType 渠道类型
     * @param code        代码
     * @param merchantId  商人id
     * @param type        类型
     * @return {@link Response<List<ChannelDTO>>}
     */
    @PostMapping("/v1/channel/searchByCodeAndType")
    Response<List<ChannelDTO>> searchByCodeAndType(@RequestParam(value = "channelType", required = false) String channelType,
                                                   @RequestParam(value = "code", required = false) String code,
                                                   @RequestParam(value = "merchantId", required = false) String merchantId,
                                                   @RequestParam(value = "type", required = false) Integer type);

    /**
     * 根据地区编码获取地区层级信息
     *
     * @param areaList
     * @return
     */
    @PostMapping("/v1/area/selectLevelRelationByCode")
    Response<List<AreaLevelDTO>> listRelationByArea(@RequestBody List<String> areaList);

    @PostMapping("/v1/store/kp/selectStoreListByCodes")
    Response<List<StoreDTO>> selectStoreListByCodes(@RequestBody List<String> codeList);

    @PostMapping("/v1/store/searchByCodeList")
    Response<List<StoreDTO>> searchByCodeList(@RequestBody List<String> codeList);

    @PostMapping("/v1/store/list")
    Response<List<com.lyf.scm.plan.api.dto.StoreInfoDTO>> listDirectStoreInfo(@RequestBody StoreDTO storeDTO);
    /**
     * 根据渠道等级查询渠道信息
     *
     * @param level
     * @return
     */
    @GetMapping("/api/v1/kpChannel/external/queryByLevel")
    Response<List<ChannelDTO>> getChannelByLevel(@RequestParam("level") Integer level);

    /**
     * 分页查询渠道
     * @param channelInfoDTO
     * @return
     */
    @PostMapping("/v1/channel/searchChannelList")
    Response<PageInfo<ChannelDTO>> getChannelPage(@RequestBody ChannelInfoDTO channelInfoDTO);
}
